1. Field Of The Invention
The present invention is a system and method for efficiently managing the reserved memory of a microcomputer.
2. Related Art
Within the internal memory of a microcomputer, certain addresses of memory are set aside to perform special system functions, and are thus not available for typical software applications to use. In the case of microcomputers, this memory, known generally as reserved memory (and referred to as original reserved memory herein), typically includes portions which can comprise video memory, the basic input/output system (BIOS) whose contents are accessed during and after the initialization of the microcomputer, and memory set aside for use by peripheral devices. Some of these portions of original reserved memory are read-only, such as the BIOS and video ROM (read-only memory), whereas some can be read/write such as the video RAM (random access memory).
In most microcomputers, the BIOS and video ROM are stored on an EPROM (erasable programmable read-only memory). This type of memory device is slower than other read/write memory devices, such as dynamic random access memory (DRAM). Since the video ROM and BIOS are typically utilized very frequently, these ROMs are often copied to a memory device (referred to herein as new system memory) having faster access time.
In view of the desirability of copying the slower, original reserved memory to a new, faster memory, a technique known as "shadowing" was devised. This technique allows for the copying of select portions of the .original reserved memory to a new system memory, and then subsequently accessing the copied portions residing on the new system memory in lieu of accessing the selected portions of the original reserved memory. In a typical shadowing scheme, the selected portions of the original reserved memory and the corresponding portions of the new system memory (to which the selected portions of the original reserved memory are copied) are at the same memory address locations. (The new system memory having address locations corresponding to the original system memory is referred to herein as shadow memory.)
To avoid corruption of data, it is important that both the selected portions of the original reserved memory being copied and corresponding portions of shadow memory are not enabled at the same time. Thus, once the selected portions of original reserved memory are copied to the shadow memory, access to the selected portions of original reserved memory are directed to the corresponding portions of the shadow memory. Reading from the shadow memory allows for quicker and more efficient access of the BIOS and any other portions of the original reserved memory that have been selected to be shadowed.
Conventionally, shadowing is performed by copying the contents of the selected portions of the original reserved memory to be shadowed to some temporary memory location. Once these selected portions are transferred into these temporary memory locations, the selected portions of the original reserved memory are disabled, and the corresponding portions of shadow memory are enabled. Then, in a second step, the contents of these temporary locations are copied into the shadow memory at the same memory address locations from which they originally came. Thereafter, access to the selected portions of the original reserved memory results in the access of corresponding portions of the shadow memory.
The problem with the conventional approach of shadowing is that it requires a two step process, in that the selected portions of the original reserved memory require a first step of being written to a temporary memory location, and then require a second step of being written to the corresponding portions in the shadow memory. In addition, the conventional approach also utilized a scheme in which a first indicator is used to determine whether the original reserved memory or the shadow memory is to be accessed, and a second indicator to determine if write-access to the shadow memory is to be permitted. The purpose of the second indicator is to prevent the shadow memory to be inadvertently written to once the contents of original reserved memory had been copied to the shadow memory. Without this second indicator, corruption of the shadow memory could otherwise result.
A problem with the above two-indicator approach is that it wastes states. For example, there would be no purpose in activating the second indicator unless the first indicator indicated that the shadow memory was to be accessed.
The conventional approach of memory management of reserved memory has another significant deficiency and problem as follows. After the selected portions of the reserved memory have been copied into the shadow memory, it is often the case that much of the shadow memory is free memory that is not utilized. That is, it is usually the case that at least some of the portions of the original reserved memory are not shadowed, and the corresponding portions in the shadow memory remain unused. Since typical software applications are not designed to be able to access reserved memory for general storage purposes, these free portions of shadow memory are wasted, unless some mechanism/approach is devised to allow access to these free portions. By "typical software application", it is simply meant a software application that is not specifically designed to write to addresses within the original reserved memory.
Conventional methods exist for accessing the free portions of shadow memory, but they are all deficient in certain respects. In one conventional method, special expanded memory drivers are used to logically re-map accessible memory locations to the free memory. However, these expanded memory drivers are utilized during run-time of the software applications rather than during initialization of the microcomputer, and tend to degrade system performance.
Another conventional scheme is to re-map the highest address that the microcomputer is capable of addressing to portions of shadow memory. The disadvantage of this conventional method is that the memory location from which the free memory is re-mapped sometimes does not border on existing memory locations, and thus the total available memory is not contiguous. That is, there is a gap between the top location of system memory and the bottom location of the additional memory made available by the re-mapping.
Further, all conventional re-mapping schemes only allow free reserved memory to be re-mapped from below the address corresponding to 16 megabytes. Thus, if there is more than 16 megabytes of new system memory, the free reserved memory cannot be re-mapped to.
Moreover, conventional re-mapping schemes do not permit typical software applications to access this free reserved memory. The conventional re-mapping schemes only allow the free reserved memory to be accessed for special purposes, such as for disk cache memory. Thus, computer programs need to be customized to take advantage of this free memory in conventional microcomputer systems and methods.